package org.future.task.core.group;

import org.future.task.core.handler.Connection;

import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

public class DefaultGroupImpl extends AbstractGroup {


    public DefaultGroupImpl(int commitThread, String sinkQueue, Connection receiveConnection, Connection sinkConnection, int batchSize, String splitStr, String queueStr) {
        super(commitThread, sinkQueue, receiveConnection, sinkConnection, batchSize, splitStr, queueStr);
    }

    public DefaultGroupImpl(int commitThread, String sinkQueue, Connection receiveConnection, Connection sinkConnection, int batchSize, Set<String> queueSet) {
        super(commitThread, sinkQueue, receiveConnection, sinkConnection, batchSize, queueSet);
    }

    public DefaultGroupImpl(int commitThread, String sinkQueue, Connection receiveConnection, Connection sinkConnection, int batchSize) {
        super(commitThread, sinkQueue, receiveConnection, sinkConnection, batchSize);
    }

    public DefaultGroupImpl(int commitThread, String sinkQueue, Connection receiveConnection, Connection sinkConnection) {
        super(commitThread, sinkQueue, receiveConnection, sinkConnection);
    }

    @Override
    public List<Object> receive(String queueName, int size, int timeOut) {
        return receiveConnection.getDataList(queueName, size, timeOut);
    }

    @Override
    public void sink(String queueName, List<Object> dataList) throws Exception {
        sinkConnection.sendDataList(queueName, dataList);
    }
}
